<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>login</title>
    <link rel="stylesheet" href="../css/Login.css">
    <link rel="stylesheet" href="//at.alicdn.com/t/font_1354112_t9673hd0ktl.css">
</head>

<body>
    <div id="login">
        <div class="loginBox w">
            <div class="login-logo">
                <img src="../../xiaomi-img/MI.png" alt="">
            </div>
            <h4 class="loginBox-h">小米账号登录</h4>

            <div class="login-main">
                <div class="login-user">
                    <input type="text" placeholder="账号" id="username">
                </div>

                <div class="login-pwd">
                    <input type="text" placeholder="密码" id="password">
                </div>


                <div class="login-ts" style="padding-top: 10px">
                    <span class="iconfont icon-gantanhao1"></span>
                    <span>请输入正确的账号或者密码</span>
                </div>


                <div class="login-btn">
                    <button id="btn">登录</button>
                </div>

                <div class="login-p cl">

                    <span class="login-l"><a href="./register.html">手机短信登录/注册</a></span>

                    <div class="login-r">
                        <span><a href="./register.html">立即注册</a></span>
                        <span>|</span>
                        <span><a href="">忘记密码？</a></span>
                    </div>


                </div>

                <div class="login-ele">
                    <span class="line"></span>
                    <span class="txt">其他登录方式</span>
                    <span class="line"></span>
                </div>

               <div class="login-oth">
                <img src="../../xiaomi-img/zhi.png" alt="">

               </div>

            </div>

           

        </div>

        <div class="footer w">
                <ul class="footer-top cl">
                    <li>简体<span>|</span></li>
                    
                    <li>繁体<span>|</span></li>
                    
                    <li>English<span>|</span></li>
                    
                    <li>常见问题</li>
                </ul>
    
                <p>
                    <span>小米公司版权所有-京ICP备10046444-</span>
                    <img src="../../xiaomi-img/record-icon.d0289dc0.png" alt="">
                    <span>京公网安备11010802020134号-京ICP证110507号</span>
                </p>
    
    
            </div>

    </div>


    </div>
</body>

<script src="../js/jquery-1.11.3.js"></script>
<!-- <script src="../js/cookie.js"></script> -->

<script>

    $('#btn').on('click',function(){
        $.ajax({
            type:'get',
            url:'http://localhost/project/xiaomi/php/mi_login.php',
            data:{
                key:$('#username').val(),
                password:$('#password').val()
            },
            dataType:'json',
            success:function(data){
                console.log(data)
                if(data.code>0){
                    location.href='../index.html'
                    localStorage.setItem('username',$('#username').val())



                }else{
                    $('.login-ts').show()
                }

            }
        })





    })


</script>


</html>